<%--
 *  File:    DataCleanRulePop.jsp
 *  @Author: Jamesli
 *  Date:    2010/07/22

 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  	Category cat = Category.getInstance("jsp.DataCleanRulePop");
	String privilegeCode = "E0211";
  	String strModuleName = "CM";
  	String contextPath = request.getContextPath();
%>

<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title>DataCleanRulePop</title>
<PageFlow:CheckPageFlow pageName="p_datacleanrulepop"/>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script type="text/javascript">
<%
	Vector details = (Vector) pageContext.getAttribute("rules");
	if(details == null) details = new Vector();
	
	if(details.size() == 0 && (String)pageContext.getAttribute("closeflag") == null ){
%>
	alert('<%= message.getMessageDesc("NO_RULE_SET_UP")%>');
	window.close();
<%}%>
function page_execute(){
	var allrule = document.getElementsByName("rulevalues");
	var valuestr = "";
	for(var i = 0 ; i < allrule.length;i++){
		if(allrule[i].checked){
			valuestr += "&rulevalues=" + allrule[i].value;
		}
	}
	if(valuestr == ""){
		alert("<%= message.getMessageDesc("PLEASE_SELECT")%>");
		return;
	}

	document.cform.target = "_self";
	isRunning = true;
	document.cform.submit();  
}

function page_checkall(){
	var checkall = cform.checkall;
	var allrule = document.getElementsByName("rulevalues");
	for(var i = 0 ; i < allrule.length;i++){
		allrule[i].checked = checkall.checked;
	}
}

<%
	String closeFlag = (String)pageContext.getAttribute("closeflag");
	if(closeFlag!= null && closeFlag.equals("Y")){
		%>
		  opener.page_summary('search');
		  window.close();
		<%
	}
%>
</script>
</head>
<body>
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_datacleanrulepop">
	<custom:hidden property="datacleanaction" changedName="actionname"/>
	<custom:hidden property="processtype"/>
	<%
		Integer[] fileids = (Integer[])pageContext.getAttribute("fileids");
		if(fileids != null){
			for(int i = 0; i < fileids.length; i++){
				%>
					<input type="hidden" name="fileids" value="<%=fileids[i] %>"/>
				<%
			}
		}
	%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr> 
    <td> 
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">        
          <tr class="deepblue-left">
            <td width="40" class="title_center"><custom:checkbox property="checkall" onclick="page_checkall()" styleClass="checkbox"/></td>
            <td width="*" class="title_center"><%= label.getLabelName("L_CheckContent")%></td>
          </tr>
        <%
          
          
          String strClassType = "";
		  int i = 0;
        %>
        <logic:iterate id="detail" collection="<%= details %>">
          <%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
            i++;
          %>
            <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%= strClassType %>'"  class="<%= strClassType %>">
              <td class="td_center"><custom:checkbox property="cleanrule" name="detail" changedName="rulevalues" styleClass="checkbox"/></td>
              <td class="td_center"><custom:write property="cleanrule" name="detail" dictType="DataCleanRule" nbsp="true"/></td>
        	</tr>
        </logic:iterate>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td class="td_center">
    	<a onclick="page_execute()"><custom:button type="1" label="L_Execute" imgsrc="close.gif" border="0" style="width:60"/></a>
    	<a onclick="window.close()"><custom:button type="1" label="L_Close" imgsrc="close.gif" border="0" style="width:60"/></a>
    </td>
  </tr>
</table>
</form>
</body>
</html>


